/*
 * Copyright (c) 2024 endless-sky
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef UTILITY_SYSTEM_UTIL_H
#define UTILITY_SYSTEM_UTIL_H

#include <string>

namespace El {
namespace Utils {

/**
 * @brief 获取当前系统的 CPU 字节序
 * @return bool true 表示大端字节序，false 表示小端字节序
 */
bool IsSystemBigEndian();

/**
 * @brief 执行系统命令
 * @param cmd 要执行的命令
 * @param output 存储命令输出的字符串指针，可以为 nullptr
 * @param timeoutSeconds 超时时间（秒），0 表示不设置超时
 * @return bool 命令执行是否成功
 */
bool ExecuteCommand(const std::string &cmd, std::string *output = nullptr, int timeoutSeconds = 60);

} // namespace Utils
} // namespace El

#endif // UTILITY_SYSTEM_UTIL_H
